<div class="page-title">
  <h2><?=$title?></h2>
</div>

<table class='general' style="width:100%; margin: 0 0px 10px 0px">
  <thead>
    <tr>
      <th style="text-align: left" width="50%">Nama</th>
      <th style="text-align: left" width="50%">Territory</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td style="padding: 8px"><?php echo $username[0]->user_id.' | '.$username[0]->user_name ; ?></td>
      <td style="padding: 8px"><?php echo $region.' '.$cluster; ?></td>
    </tr>
    <tr>
      <td class="align-center" colspan="2">
        <a href="<?php echo base_url('index.php/jc/cc/add/8'); ?>">Kunjungan Outlet</a>
        <a href="<?php echo base_url('index.php/jc/cc/add/9'); ?>">Kunjungan Agent/Mobsel</a>
      </td>
    </tr>
  </tbody>
</table>

<?php // print_r($journey); ?>

<?php foreach ($journey as $key => $value) { ?>
  <?php echo '<p style="margin-left: 10px; font-size: 12px; font-weight: bold;">'.date('j F Y', strtotime($key)).'</p>'; ?>  
    <table class="item-list" style="width:100%; margin: 10px 0px 10px 0px;"> 
      <thead>
        <tr>
          <th>#</th>
          <th>Channel ID</th>
          <th>Channel Name</th>
          <th>Maintaned By</th>
          <th>Tipe Kunjungan</th>
        </tr>
      </thead>
      <tbody>
        <?php $x=1; foreach ($value as $key) { ?>
          <tr>
            <td><?php echo $x; ?></td>
            <td><?php echo $key->channel_id; ?></td>
            <td><?php echo $key->channel_name; ?></td>
            <td><?php echo $key->sales_id.' |  '.$key->sales_name.' | '.$key->user_group; ?></td>
            <td><?php echo $key->journey_type; ?></td>
          </tr>
        <?php $x++; }?>
      </tbody>
    </table>
<?php } ?>